pkgname=kdelibs4support
pkgver=5.36.0
pkgrel=1
pkgdesc='Porting aid from KDELibs4'
arch="all"
url='https://community.kde.org/Frameworks'
license="LGPL"
depends="kunitconversion kitemmodels kemoticons kded kparts"
makedepends="extra-cmake-modules kdoctools qt5-qttools-dev networkmanager perl-uri python kdesignerplugin kunitconversion kemoticons kded kparts"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/portingAids/${pkgname}-${pkgver}.tar.xz"
subpackages="$pkgname-doc $pkgname-lang"

prepare() {
	mkdir -p $srcdir/build
}

build() {
	cd $srcdir/build
	cmake "$srcdir"/${pkgname}-${pkgver} \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DKDE_INSTALL_LIBDIR=lib \
		-DKDE_INSTALL_LIBEXECDIR=lib \
		-DBUILD_TESTING=OFF
	make
}

package() {
	cd $srcdir/build
	make DESTDIR="${pkgdir}" install

	# cert bundle seems to be hardcoded
	# link it to the one from ca-certificates
	rm -f "$pkgdir"/usr/share/kf5/kssl/ca-bundle.crt
	ln -sf /etc/ssl/certs/ca-certificates.crt "${pkgdir}"/usr/share/kf5/kssl/ca-bundle.crt

	chmod 0644 $pkgdir/usr/lib/kf5/fileshareset # remove suid bit as it's disallowed by Alpine standards due to being a security risk
}
sha512sums="f5f21034ccb1dbf6f54a250ab8e2b22b7d942932a9399e67ffb994c7f857946616545f0b5a59b1ff2691d744c60ea0888d4a906c5caaa837950bcd81be07eeed  kdelibs4support-5.36.0.tar.xz"
